package com.zkadmin.repository;

import java.util.List;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.querydsl.QueryDslPredicateExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;

import com.zkadmin.entity.SysMenu;

public interface SysMenuRepository extends PagingAndSortingRepository<SysMenu, Long>, QueryDslPredicateExecutor<SysMenu> {

	public List<SysMenu> findByCodeLike(String code, Sort sort);

	public List<SysMenu> findByCodeLike(String code);

	public SysMenu findByName(String name);

	public SysMenu findByCode(String code);
	
	@Query("select m from SysMenu m group by m.code")
	public Page<SysMenu> findGrouped(Pageable pageable);

}
